<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <title>v-for列表渲染</title>
</head>

<body>
    <div id="app">
        <h3>大学生阅读清单</h3>
        <ul>
            <li v-for="(book, index) in books" :key="book.id">
                {{index+1}}.{{book.title}}
            </li>
        </ul>
    </div>
    <script>
        const App = {
            data() {
                return {
                    books: [
                        { id: 1, title: '《JavaScript高级程序设计》' },
                        { id: 2, title: '《Vue.js实战》' },
                        { id: 3, title: '《深入浅出Node.js》' }
                    ]
                }
            }
        };
        Vue.createApp(App).mount('#app');
    </script>
</body>

</html>